import 'package:doodle_dash/tank/MyTank.dart';
import 'package:flame/extensions.dart';

import 'Tank.dart';

class Tank extends TankModel  {
  Tank(MyTank game, String url1, String url2, Offset offset, TankID tankId):super(game, url1, url2, offset, tankId){
    bodyRect = Rect.fromLTWH(-20 * ration, -15 * ration, 38 * ration, 32 * ration);
    paoRect = Rect.fromLTWH(-1, -2 * ration, 22 * ration, 6 * ration);
  }

  void move(double dt) {
    if (bodyAngleT != 0) {
      if (bodyAngle == bodyAngleT) {
        //tank 直线时 移动速度快
        position =
            position + Offset.fromDirection(bodyAngle, 200 * dt); //100 是像素
      } else {
        //tank旋转时 移动速度要慢
        position = position + Offset.fromDirection(bodyAngle, 140 * dt);
      }
      if (!game.screenSize.contains(position)) {
        print('到边界了');
        //status = BulletStatus.outOfBorder;
      }
    }
  }

  @override
  double getBulletAngle() {
    // TODO: implement getBulletAngle
    throw UnimplementedError();
  }
  
  @override
  Offset getBulletOffset() {
    // TODO: implement getBulletOffset
    throw UnimplementedError();
  }
}
